<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/left.css">
    <script src="js/jquery.min.js" type="text/javascript"></script>

    <script src="js/bootstrap.min.js" type="text/javascript"></script>
    <script src="js/vue.js"></script>
    <style>

        .mrow{margin-top:15px;padding:5px 15px;}
        .msg{padding-top:10px;font-size:16px;font-weight: bold}
        .file{opacity: 0;width:0;height:0;position:absolute;top:0;left:0;z-index:-1}

    </style>
    <title>驾校信息管理</title>
    <script>
        window.onload=function(){
            var href = location.href;
            var id = 0;
            if(href.indexOf("?")>0){
                var id = href.split("?")[1];
                id = id.split("=")[1];
            }

            var vue = new Vue({
                el:'#app',
                data:{
                    url:'http://localhost:8889',
                    oneReve:{},
                    classInfo:{
                        coach:{
                            coaName:"记载中"
                        },
                        subject:{
                            subType:"加载中"
                        }

                    }
                },
                methods:{
                    query:function(){
                        var that = this;
                        if(id>0){
                            $.getJSON(that.url+'/student/queryOneRes'+"/"+id,function(data){
                                if(data){
                                    if(data!=null){
                                        that.oneReve = data
                                    }
                                    if(data.classInfoList[0]!=null){
                                        that.classInfo = data.classInfoList[0]
                                    }
                                    console.log(data)
                                    console.log(that.classInfo)
                                }
                            })
                        }

                    },
                    save:function(){
                        var that =this;
                        var comment = $("#comment").val();
                        var date = new Date();
                        if((date.getMonth()+1)<=9){
                            if(date.getDate<=9){
                                var resDate = date.getFullYear()+"-0"+(date.getMonth()+1)+"-0"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
                            }else{
                                var resDate = date.getFullYear()+"-0"+(date.getMonth()+1)+"-0"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
                            }
                        }else{
                            if(date.getDate<=9){
                                var resDate = date.getFullYear()+(date.getMonth()+1)+"-0"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
                            }else{
                                var resDate = date.getFullYear()+(date.getMonth()+1)+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
                            }
                        }


                        console.log(resDate)
                        console.log(id)
                        console.log(comment)
                        if(comment!=null){
                            var info = {
                                id:id,
                                comTime: resDate,
                                comment:comment
                            }
                            $.post(that.url+"/reverse/saveComm",info,function(data){
                                console.log(data)
                                if(data){
                                    $("#msg").html("<span style='color:darkgreen'>评论信息保存成功！</span>");
                                }
                            })

                        }else{
                            $("#msg").html("<span style='color:red'>请输入评论信息！</span>");
                        }
                    }

                }
            })
            vue.query();
            $("#header").load("header.html");
            $("#left").load("left.html");

        }
    </script>

</head>
<body>
<div class="container-fluid bgcon" id="app">
    <!-- 表头-->
    <div class="row" id="header">

    </div>
    <!--内容体-->
    <div class="row">

        <!-- 左边菜单-->
        <div class="col-md-2" id="left">

        </div>
        <!-- 左边内容体-->
        <div class="col-md-9" style="margin-left:30px;margin-top:10px">

            <div class="row tithead">
                <div class="col-md-4"><h3 class="glyphicon glyphicon-bed"> 新增评论信息
                </h3></div>
                <div class="col-md-6"></div>

                <div class="col-md-2" >

                </div>

            </div>

            <div class="row">
                <div class="col-md-12">

                    <div>
                        <!-- 导航栏 -->
                        <ul class="nav nav-tabs" role="tablist"style="marign-bottom:20px;margin-top:10px">
                            <li role="presentation" class="active">
                                <a href="#school" aria-controls="coa" role="tab" data-toggle="tab">评论信息</a>
                            </li>

                        </ul>
                        <div class="row"style="height:20px"></div>
                        <!-- 身体 -->
                        <div class="tab-content" style="marign-top:10px">

                            <div role="tabpanel" class="tab-pane active" id="school">

                                <div class="row">
                                    <div class="form-group mrow col-md-6">
                                        <div class="input-group">
                                            <label class="input-group-addon">学员姓名</label>
                                            <input v-model="oneReve.stuName" class="form-control" readonly>
                                        </div>
                                    </div>
                                    <div class="form-group mrow col-md-6">
                                        <div class="input-group">
                                            <label class="input-group-addon">教练姓名</label>
                                            <input v-model="classInfo.coach.coaName" class="form-control" readonly>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="form-group mrow col-md-6">
                                        <div class="input-group">
                                            <label class="input-group-addon">教学时间</label>
                                            <input v-model="classInfo.teaTime" class="form-control" readonly>
                                        </div>
                                    </div>
                                    <div class="form-group mrow col-md-6">
                                        <div class="input-group">
                                            <label class="input-group-addon">科目</label>
                                            <input v-model="classInfo.subject.subType" class="form-control" readonly>
                                        </div>
                                    </div>
                                    <div class="form-group mrow col-md-6">
                                        <div class="input-group">
                                            <label class="input-group-addon">场次</label>
                                            <input v-model="classInfo.classSess" class="form-control" readonly>
                                        </div>
                                    </div>
                                </div>

                                <div class="row">
                                    <h3 class="panel-heading">评论信息</h3>
                                    <hr>
                                    <textarea id="comment" class="form-control" rows="7" cols="50`" style="font-size: 18px"></textarea>
                                </div>


                                <div class="row mrow" style="margin-top:100px">
                                    <div class="col-md-10">
                                        <p class="text-center msg"id="msg"></p>
                                    </div>
                                    <div class="col-md-2">
                                        <button @click="save" class="btn btn-primary btn-block">保存</button>
                                    </div>
                                </div>

                            </div>

                        </div>

                    </div>
                </div>
            </div>
            <div class="row text-right remark"><h5>备注：驾校详细信息录入</h5></div>
        </div>
    </div>
</div>
</body>
</html>